From: Sebastian Keller Date: Wed, 21 Jan 2026 21:54:39 +0000 (+0100) Subject: main: Only call gjs_dumpstack() on warnings from main thread X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~39^2~1^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=23e3e7970f1ef316c0a5bce2dea4872cf1ca5750;p=gnome-shell.git main: Only call gjs_dumpstack() on warnings from main thread The mozjs code called by gjs_dumpstack() does not appear to be thread safe and was sometimes resulting in crashes when triggered by error messages from threads other than the main thread. And even when not crashing, such a backtrace can only be misleading since only the main thread is executing JS code. Part-of: --- diff --git a/src/main.c b/src/main.c index 2cef065f9..6bf1304ba 100644 --- a/src/main.c +++ b/src/main.c @@ -52,6 +52,7 @@ enum { }; static int _shell_debug; static gboolean _tracked_signals[NSIG] = { 0 }; +static GThread *main_thread; static void shell_dbus_acquire_name (GDBusProxy *bus, @@ -382,7 +383,8 @@ default_log_writer (GLogLevelFlags log_level, if ((_shell_debug & SHELL_DEBUG_BACKTRACE_WARNINGS) && ((log_level & G_LOG_LEVEL_CRITICAL) || - (log_level & G_LOG_LEVEL_WARNING))) + (log_level & G_LOG_LEVEL_WARNING)) && + g_thread_self () == main_thread) { const char *log_domain = NULL; @@ -609,6 +611,8 @@ main (int argc, char **argv) g_setenv ("GJS_DEBUG_OUTPUT", "stderr", TRUE); g_setenv ("GJS_DEBUG_TOPICS", "JS ERROR;JS LOG", TRUE); + main_thread = g_thread_self (); + context = meta_create_context (WM_NAME); meta_context_add_option_entries (context, gnome_shell_options, GETTEXT_PACKAGE);